import request from '@/utils/request.js'

// 获取部门列表信息
export const getDepartments = () => {
  return request.get('/company/department')
}
// export const delDepartments = (id) => {
//   return request.delete(` /company/department/${id}`)
// }

// 删除列表
export function delDepartments (id) {
  return request({
    url: `/company/department/${id}`,
    method: 'delete'
  })
}

// 新增部门接口
export const addDepartments = (data) => {
  return request.post('/company/department', data)
}

// export function addDepartments (data) {
//   return request({
//     url: '/company/department',
//     method: 'post',
//     data
//   })
// }

// 编辑部门回填数据
export function getDepartDetail (id) {
  return request({
    url: `/company/department/${id}`
  })
}

export function updateDepartments (data) {
  return request({
    url: `/company/department/${data.id}`,
    method: 'put',
    data
  })
}
